package
{
	import com.demonsters.debugger.MonsterDebugger;
	
	import flash.display.Sprite;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import flash.events.Event;
	
	import starling.core.Starling;
	import starling.events.Event;
	import starling.utils.HAlign;
	import starling.utils.VAlign;
	[SWF(backgroundColor="0xec9900" , width="320" , height="480",frameRate="60")]
	public class Main extends Sprite
	{
		private var _starling:Starling;
		public function Main()
		{
			addEventListener(flash.events.Event.ADDED_TO_STAGE,init);
		}
		
		private function init(e:flash.events.Event):void{
			removeEventListener(flash.events.Event.ADDED_TO_STAGE,init);
			_starling = new Starling(RootClass,stage);
			
			_starling.antiAliasing = 2;
			_starling.makeCurrent();
			_starling.showStats = true;
			_starling.showStatsAt(HAlign.LEFT,VAlign.BOTTOM);
			_starling.addEventListener("rootCreated",onRootCreated);
		}
		
		private function onRootCreated(e:starling.events.Event):void{
			_starling.removeEventListener("rootCreated",onRootCreated);
			_starling.start();
			MonsterDebugger.initialize(this);
			MonsterDebugger.trace("stage.stageWidth ->",stage.stageWidth);
			MonsterDebugger.trace("stage.stageHeight ->",stage.stageHeight);
		}
	}
}